from products.data_warehouse.backend.types import IncrementalFieldType

RESOURCE_SCHEMAS = {
    "ad": {
        "resource_name": "ad_group_ad",
        "primary_key": ["ad_group_ad.ad.id", "ad_group.id", "campaign.id", "customer.id"],
        "field_names": [
            "ad_group_ad.ad.id",
            "ad_group.id",
            "campaign.id",
            "customer.id",
            "ad_group_ad.ad.added_by_google_ads",
            "ad_group_ad.ad.app_ad.descriptions",
            "ad_group_ad.ad.app_ad.headlines",
            "ad_group_ad.ad.app_ad.html5_media_bundles",
            "ad_group_ad.ad.app_ad.images",
            "ad_group_ad.ad.app_ad.mandatory_ad_text",
            "ad_group_ad.ad.app_ad.youtube_videos",
            "ad_group_ad.ad.call_ad.phone_number",
            "ad_group_ad.ad.device_preference",
            "ad_group_ad.ad.display_url",
            "ad_group_ad.ad.expanded_dynamic_search_ad.description",
            "ad_group_ad.ad.expanded_dynamic_search_ad.description2",
            "ad_group_ad.ad.expanded_text_ad.description",
            "ad_group_ad.ad.expanded_text_ad.description2",
            "ad_group_ad.ad.expanded_text_ad.headline_part1",
            "ad_group_ad.ad.expanded_text_ad.headline_part2",
            "ad_group_ad.ad.expanded_text_ad.headline_part3",
            "ad_group_ad.ad.expanded_text_ad.path1",
            "ad_group_ad.ad.expanded_text_ad.path2",
            "ad_group_ad.ad.final_app_urls",
            "ad_group_ad.ad.final_mobile_urls",
            "ad_group_ad.ad.final_urls",
            "ad_group_ad.ad_group",
            "ad_group_ad.ad.image_ad.image_url",
            "ad_group_ad.ad.image_ad.mime_type",
            "ad_group_ad.ad.image_ad.name",
            "ad_group_ad.ad.image_ad.pixel_height",
            "ad_group_ad.ad.image_ad.pixel_width",
            "ad_group_ad.ad.legacy_responsive_display_ad.accent_color",
            "ad_group_ad.ad.legacy_responsive_display_ad.allow_flexible_color",
            "ad_group_ad.ad.legacy_responsive_display_ad.business_name",
            "ad_group_ad.ad.legacy_responsive_display_ad.call_to_action_text",
            "ad_group_ad.ad.legacy_responsive_display_ad.description",
            "ad_group_ad.ad.legacy_responsive_display_ad.format_setting",
            "ad_group_ad.ad.legacy_responsive_display_ad.logo_image",
            "ad_group_ad.ad.legacy_responsive_display_ad.long_headline",
            "ad_group_ad.ad.legacy_responsive_display_ad.main_color",
            "ad_group_ad.ad.legacy_responsive_display_ad.marketing_image",
            "ad_group_ad.ad.legacy_responsive_display_ad.price_prefix",
            "ad_group_ad.ad.legacy_responsive_display_ad.promo_text",
            "ad_group_ad.ad.legacy_responsive_display_ad.short_headline",
            "ad_group_ad.ad.legacy_responsive_display_ad.square_logo_image",
            "ad_group_ad.ad.legacy_responsive_display_ad.square_marketing_image",
            "ad_group_ad.ad.name",
            "ad_group_ad.ad.responsive_display_ad.accent_color",
            "ad_group_ad.ad.responsive_display_ad.business_name",
            "ad_group_ad.ad.responsive_display_ad.call_to_action_text",
            "ad_group_ad.ad.responsive_display_ad.descriptions",
            "ad_group_ad.ad.responsive_display_ad.format_setting",
            "ad_group_ad.ad.responsive_display_ad.headlines",
            "ad_group_ad.ad.responsive_display_ad.logo_images",
            "ad_group_ad.ad.responsive_display_ad.long_headline",
            "ad_group_ad.ad.responsive_display_ad.main_color",
            "ad_group_ad.ad.responsive_display_ad.marketing_images",
            "ad_group_ad.ad.responsive_display_ad.price_prefix",
            "ad_group_ad.ad.responsive_display_ad.promo_text",
            "ad_group_ad.ad.responsive_display_ad.square_logo_images",
            "ad_group_ad.ad.responsive_display_ad.square_marketing_images",
            "ad_group_ad.ad.responsive_display_ad.youtube_videos",
            "ad_group_ad.ad.responsive_search_ad.descriptions",
            "ad_group_ad.ad.responsive_search_ad.headlines",
            "ad_group_ad.ad.responsive_search_ad.path1",
            "ad_group_ad.ad.responsive_search_ad.path2",
            "ad_group_ad.ad_strength",
            "ad_group_ad.ad.system_managed_resource_source",
            "ad_group_ad.ad.text_ad.description1",
            "ad_group_ad.ad.text_ad.description2",
            "ad_group_ad.ad.text_ad.headline",
            "ad_group_ad.ad.tracking_url_template",
            "ad_group_ad.ad.type",
            "ad_group_ad.ad.url_custom_parameters",
            "ad_group_ad.policy_summary.approval_status",
            "ad_group_ad.status",
        ],
    },
    "ad_stats": {
        "resource_name": "ad_group_ad",
        "primary_key": [
            "ad_group_ad.ad.id",
            "ad_group.id",
            "campaign.id",
            "customer.id",
            "segments.ad_network_type",
            "segments.click_type",
            "segments.date",
            "segments.device",
        ],
        "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
        "field_names": [
            "ad_group_ad.ad.id",
            "ad_group.id",
            "campaign.id",
            "customer.id",
            "customer.currency_code",
            "ad_group_ad.ad_group",
            "ad_group.base_ad_group",
            "campaign.base_campaign",
            "metrics.active_view_cpm",
            "metrics.active_view_ctr",
            "metrics.active_view_impressions",
            "metrics.active_view_measurability",
            "metrics.active_view_measurable_cost_micros",
            "metrics.active_view_measurable_impressions",
            "metrics.active_view_viewability",
            "metrics.average_cost",
            "metrics.average_cpc",
            "metrics.average_cpm",
            "metrics.clicks",
            "metrics.conversions",
            "metrics.conversions_from_interactions_rate",
            "metrics.conversions_value",
            "metrics.cost_micros",
            "metrics.cost_per_conversion",
            "metrics.cost_per_current_model_attributed_conversion",
            "metrics.ctr",
            "metrics.current_model_attributed_conversions",
            "metrics.gmail_forwards",
            "metrics.gmail_saves",
            "metrics.gmail_secondary_clicks",
            "metrics.impressions",
            "metrics.interaction_event_types",
            "metrics.interaction_rate",
            "metrics.interactions",
            "metrics.value_per_conversion",
            "metrics.value_per_current_model_attributed_conversion",
            "segments.ad_network_type",
            "segments.click_type",
            "segments.date",
            "segments.day_of_week",
            "segments.device",
            "segments.month",
            "segments.quarter",
            "segments.week",
            "segments.year",
        ],
    },
    "ad_group": {
        "resource_name": "ad_group",
        "primary_key": ["ad_group.id", "campaign.id", "customer.id"],
        "field_names": [
            "ad_group.id",
            "campaign.id",
            "customer.id",
            "ad_group.ad_rotation_mode",
            "ad_group.cpc_bid_micros",
            "ad_group.cpm_bid_micros",
            "ad_group.cpv_bid_micros",
            "ad_group.display_custom_bid_dimension",
            "ad_group.effective_target_cpa_micros",
            "ad_group.effective_target_cpa_source",
            "ad_group.effective_target_roas",
            "ad_group.effective_target_roas_source",
            "ad_group.name",
            "ad_group.status",
            "ad_group.tracking_url_template",
            "ad_group.type",
            "ad_group.url_custom_parameters",
            "campaign.bidding_strategy",
            "campaign.bidding_strategy_type",
            "campaign.manual_cpc.enhanced_cpc_enabled",
            "campaign.percent_cpc.enhanced_cpc_enabled",
        ],
    },
    "ad_group_stats": {
        "resource_name": "ad_group",
        "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
        "primary_key": [
            "ad_group.id",
            "campaign.id",
            "customer.id",
            "segments.ad_network_type",
            "segments.click_type",
            "segments.date",
            "segments.device",
        ],
        "field_names": [
            "ad_group.id",
            "campaign.id",
            "customer.id",
            "customer.currency_code",
            "ad_group.base_ad_group",
            "campaign.base_campaign",
            "metrics.active_view_cpm",
            "metrics.active_view_ctr",
            "metrics.active_view_impressions",
            "metrics.active_view_measurability",
            "metrics.active_view_measurable_cost_micros",
            "metrics.active_view_measurable_impressions",
            "metrics.active_view_viewability",
            "metrics.average_cost",
            "metrics.average_cpc",
            "metrics.average_cpm",
            "metrics.clicks",
            "metrics.conversions",
            "metrics.conversions_from_interactions_rate",
            "metrics.conversions_value",
            "metrics.cost_micros",
            "metrics.cost_per_conversion",
            "metrics.cost_per_current_model_attributed_conversion",
            "metrics.ctr",
            "metrics.current_model_attributed_conversions",
            "metrics.current_model_attributed_conversions_value",
            "metrics.gmail_forwards",
            "metrics.gmail_saves",
            "metrics.gmail_secondary_clicks",
            "metrics.impressions",
            "metrics.interaction_event_types",
            "metrics.interaction_rate",
            "metrics.interactions",
            "metrics.value_per_conversion",
            "metrics.value_per_current_model_attributed_conversion",
            "segments.ad_network_type",
            "segments.click_type",
            "segments.date",
            "segments.day_of_week",
            "segments.device",
            "segments.month",
            "segments.quarter",
            "segments.week",
            "segments.year",
        ],
    },
    "campaign": {
        "resource_name": "campaign",
        "primary_key": ["campaign.id", "customer.id"],
        "field_names": [
            "campaign.id",
            "customer.id",
            "campaign.advertising_channel_sub_type",
            "campaign.advertising_channel_type",
            "campaign.bidding_strategy",
            "campaign.bidding_strategy_type",
            "campaign_budget.amount_micros",
            "campaign_budget.explicitly_shared",
            "campaign_budget.has_recommended_budget",
            "campaign_budget.period",
            "campaign_budget.recommended_budget_amount_micros",
            "campaign_budget.total_amount_micros",
            "campaign.campaign_budget",
            "campaign.end_date",
            "campaign.experiment_type",
            "campaign.manual_cpc.enhanced_cpc_enabled",
            "campaign.maximize_conversion_value.target_roas",
            "campaign.name",
            "campaign.percent_cpc.enhanced_cpc_enabled",
            "campaign.serving_status",
            "campaign.start_date",
            "campaign.status",
            "campaign.tracking_url_template",
            "campaign.url_custom_parameters",
        ],
    },
    "campaign_stats": {
        "resource_name": "campaign",
        "primary_key": [
            "campaign.id",
            "customer.id",
            "segments.ad_network_type",
            "segments.click_type",
            "segments.date",
            "segments.device",
        ],
        "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
        "field_names": [
            "campaign.id",
            "customer.id",
            "customer.currency_code",
            "campaign.base_campaign",
            "metrics.active_view_cpm",
            "metrics.active_view_ctr",
            "metrics.active_view_impressions",
            "metrics.active_view_measurable_impressions",
            "metrics.active_view_viewability",
            "metrics.average_cost",
            "metrics.average_cpc",
            "metrics.average_cpm",
            "metrics.clicks",
            "metrics.conversions",
            "metrics.conversions_from_interactions_rate",
            "metrics.conversions_value",
            "metrics.cost_micros",
            "metrics.cost_per_conversion",
            "metrics.cost_per_current_model_attributed_conversion",
            "metrics.ctr",
            "metrics.current_model_attributed_conversions",
            "metrics.current_model_attributed_conversions_value",
            "metrics.gmail_forwards",
            "metrics.gmail_saves",
            "metrics.gmail_secondary_clicks",
            "metrics.impressions",
            "metrics.interaction_event_types",
            "metrics.interaction_rate",
            "metrics.interactions",
            "metrics.value_per_conversion",
            "metrics.value_per_current_model_attributed_conversion",
            "segments.ad_network_type",
            "segments.click_type",
            "segments.date",
            "segments.day_of_week",
            "segments.device",
            "segments.month",
            "segments.quarter",
            "segments.week",
            "segments.year",
        ],
    },
    "keyword": {
        "resource_name": "keyword_view",
        "primary_key": ["ad_group_criterion.criterion_id", "ad_group.id", "campaign.id", "customer.id"],
        "field_names": [
            "ad_group_criterion.criterion_id",
            "ad_group.id",
            "campaign.id",
            "customer.id",
            "ad_group_criterion.approval_status",
            "ad_group_criterion.effective_cpc_bid_micros",
            "ad_group_criterion.effective_cpc_bid_source",
            "ad_group_criterion.effective_cpm_bid_micros",
            "ad_group_criterion.final_mobile_urls",
            "ad_group_criterion.final_url_suffix",
            "ad_group_criterion.final_urls",
            "ad_group_criterion.keyword.match_type",
            "ad_group_criterion.keyword.text",
            "ad_group_criterion.negative",
            "ad_group_criterion.position_estimates.estimated_add_clicks_at_first_position_cpc",
            "ad_group_criterion.position_estimates.estimated_add_cost_at_first_position_cpc",
            "ad_group_criterion.position_estimates.first_page_cpc_micros",
            "ad_group_criterion.position_estimates.first_position_cpc_micros",
            "ad_group_criterion.position_estimates.top_of_page_cpc_micros",
            "ad_group_criterion.quality_info.creative_quality_score",
            "ad_group_criterion.quality_info.post_click_quality_score",
            "ad_group_criterion.quality_info.quality_score",
            "ad_group_criterion.quality_info.search_predicted_ctr",
            "ad_group_criterion.status",
            "ad_group_criterion.system_serving_status",
            "ad_group_criterion.topic.topic_constant",
            "ad_group_criterion.tracking_url_template",
            "ad_group_criterion.url_custom_parameters",
            "campaign.bidding_strategy",
            "campaign.bidding_strategy_type",
            "campaign.manual_cpc.enhanced_cpc_enabled",
            "campaign.percent_cpc.enhanced_cpc_enabled",
        ],
    },
    "keyword_stats": {
        "resource_name": "keyword_view",
        "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
        "primary_key": [
            "ad_group_criterion.criterion_id",
            "ad_group.id",
            "campaign.id",
            "customer.id",
            "segments.ad_network_type",
            "segments.click_type",
            "segments.date",
            "segments.device",
        ],
        "field_names": [
            "ad_group_criterion.criterion_id",
            "ad_group.id",
            "campaign.id",
            "customer.id",
            "customer.currency_code",
            "ad_group.base_ad_group",
            "campaign.base_campaign",
            "metrics.active_view_cpm",
            "metrics.active_view_ctr",
            "metrics.active_view_impressions",
            "metrics.active_view_measurability",
            "metrics.active_view_measurable_cost_micros",
            "metrics.active_view_measurable_impressions",
            "metrics.active_view_viewability",
            "metrics.average_cost",
            "metrics.average_cpc",
            "metrics.average_cpm",
            "metrics.clicks",
            "metrics.conversions",
            "metrics.conversions_from_interactions_rate",
            "metrics.conversions_value",
            "metrics.cost_micros",
            "metrics.cost_per_conversion",
            "metrics.cost_per_current_model_attributed_conversion",
            "metrics.ctr",
            "metrics.current_model_attributed_conversions",
            "metrics.current_model_attributed_conversions_value",
            "metrics.gmail_forwards",
            "metrics.gmail_saves",
            "metrics.gmail_secondary_clicks",
            "metrics.impressions",
            "metrics.interaction_event_types",
            "metrics.interaction_rate",
            "metrics.interactions",
            "metrics.value_per_conversion",
            "metrics.value_per_current_model_attributed_conversion",
            "segments.ad_network_type",
            "segments.click_type",
            "segments.date",
            "segments.day_of_week",
            "segments.device",
            "segments.month",
            "segments.quarter",
            "segments.week",
            "segments.year",
        ],
    },
    "video": {
        "resource_name": "video",
        "primary_key": ["video.id", "ad_group.id", "campaign.id", "customer.id"],
        "field_names": [
            "campaign.id",
            "ad_group.id",
            "customer.id",
            "video.id",
            "ad_group_ad.status",
            "video.duration_millis",
            "video.title",
        ],
    },
    "video_stats": {
        "resource_name": "video",
        "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
        "primary_key": [
            "ad_group_ad.ad.id",
            "video.id",
            "ad_group.id",
            "campaign.id",
            "customer.id",
            "segments.ad_network_type",
            "segments.click_type",
            "segments.date",
            "segments.device",
        ],
        "field_names": [
            "ad_group_ad.ad.id",
            "ad_group.id",
            "campaign.id",
            "video.channel_id",
            "customer.id",
            "customer.currency_code",
            "video.id",
            "ad_group_ad.status",
            "metrics.all_conversions_from_interactions_rate",
            "metrics.average_cpm",
            "metrics.clicks",
            "metrics.conversions",
            "metrics.conversions_value",
            "metrics.cost_micros",
            "metrics.cost_per_conversion",
            "metrics.ctr",
            "metrics.impressions",
            "segments.ad_network_type",
            "segments.click_type",
            "segments.date",
            "segments.day_of_week",
            "segments.device",
            "segments.month",
            "segments.quarter",
            "segments.week",
            "segments.year",
        ],
    },
}
